%% Author: kevin.jingqiu
%% Created: May 29, 2009
%% Description: TODO: Add description to p2
-module(p2).

%%
%% Include files
%%

%%
%% Exported Functions
%%
-export([solve/0]).

%%
%% API Functions
%%
solve() -> p2(1, 2, 4000000, 0).



%%
%% Local Functions
%%

p2(X1, X2, Total,Sum) when X2 < Total ->
	case (X2 rem 2) of
		0 -> p2(X2, X1+X2, Total, Sum+X2);
		1 -> p2(X2, X1+X2, Total, Sum)
	end;
p2(_, _, _, Sum) -> Sum.

